package com.hades.servlet;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class Servlet1 extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Object username = request.getParameter("username");
        System.out.println("在Servlet1（柜台1）中查看参数（材料）：" + username);
        //首检、盖章，传到Servlet2（柜台2）
        request.setAttribute("key1","柜台1的章");
        //问路，柜台2怎么走
        RequestDispatcher requestDispatcher = request.getRequestDispatcher("/servlet2");
        //走向柜台2
        requestDispatcher.forward(request,response);
    }
}
